package com.accloud.service;

import com.google.gson.JsonElement;

public class TopicData {
    public static final String FRAME_CUSTOM = "customData";
    public static final String FRAME_DEVICE = "deviceData";
    private String key;
    private transient String subDomain;
    private String type;
    private JsonElement value;

    protected TopicData(TopicData topicData, String subDomain2) {
        this.type = topicData.type;
        this.key = topicData.key;
        this.value = topicData.value;
        this.subDomain = subDomain2;
    }

    public void setSubDomain(String subDomain2) {
        this.subDomain = subDomain2;
    }

    public String getSubDomain() {
        return this.subDomain;
    }

    public String getType() {
        return this.type;
    }

    public String getKey() {
        return this.key;
    }

    public String getValue() {
        return this.value.toString();
    }

    public String toString() {
        return "TopicData{subDomain='" + this.subDomain + "', type='" + this.type + "', key='" + this.key + "', value=" + this.value + '}';
    }

    public Topic parseTopic() {
        String key2 = getKey();
        String type2 = getType();
        char c = 65535;
        switch (type2.hashCode()) {
            case -336102634:
                if (type2.equals(Topic.STATUS)) {
                    c = 1;
                    break;
                }
                break;
            case 1111052281:
                if (type2.equals(Topic.PROPERTY)) {
                    c = 0;
                    break;
                }
                break;
            case 1192323320:
                if (type2.equals(Topic.WARNING)) {
                    c = 2;
                    break;
                }
                break;
        }
        switch (c) {
            case 0:
                return DeviceTopic.property(this.subDomain, Long.valueOf(key2).longValue());
            case 1:
                return DeviceTopic.status(this.subDomain, Long.valueOf(key2).longValue());
            case 2:
                return DeviceTopic.warning(this.subDomain, Long.valueOf(key2).longValue());
            default:
                return Topic.customTopic(this.subDomain, this.type, key2);
        }
    }
}
